Conversation
|
|
||
| tracer.init({ | ||
| hostname: "dd-agent-hostname", | ||
| logInjection: false |
There was a problem hiding this comment.
Hey @erickhun,
Curious to know what differences you found between using logInjection: true which supports pino and doing the injection manually like we are doing in this PR. Is the injected data different?
There was a problem hiding this comment.
@esclapes good one, i've tried to add the traceID with switching the logInjection to true as you said, but it didn't work out of the box 🤔. It's why i've ended up with the manual tracing.
I'm not too sure how we can make it detect by the dd-trace plugin out of the box. but if you have any idea to make that work that'd be awesome.
There was a problem hiding this comment.
@erickhun 🤔 my hunch is that it's an issue with the order of the imports. I believe the .init call needs to happen before anything else is imported so that dd-trace has time to monkey patch the supported libraries.
We usually place all the init code in a separate file and then import that file at the top of the index. This is a recent example
There was a problem hiding this comment.
@esclapes oh thanks! i'll try this in an other branch. Sorry if that might look obvious, still trying to get up to speed with js 😅
There was a problem hiding this comment.
Glad to know that it works! It feels nice to use the dd-trace feature for this, as it will probably be updated with newer features and bug fixes that may not be obvious to us.
💯
Append
trace_idandspan_idto the logs.We use the
mixin()function of pino to append traces to the logs.Pre-Requirement:
The service using the lib will need to also have the
dd-tracelibrary installed. If not, nothing will be appended to the logs.How to initialise the tracer in a service:
Results:
cc @esclapes @colinscape if you have any comments :) ( I also tried to add tests with #3 , but I couldn't figure out yet how to properly test what's sent to
stdout)